package com.myfoon.view.context.helper;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import java.util.ArrayList;

import javax.faces.context.FacesContext;


public class DocumentHelper {
    public DocumentHelper() {
    }
    
    public ArrayList<String> getTerms() {
        FacesContext context = FacesContext.getCurrentInstance();
        String localeString = context.getViewRoot().getLocale().toString();
                        
        File file = new File("tos_" + localeString + ".properties");
        BufferedReader reader;
        
        ArrayList<String> terms = new ArrayList<String>();
        String line = null;
        
        try {
            reader = new BufferedReader(new FileReader(file));
            
            while ((line = reader.readLine()) != null) {
                terms.add(line);
            }
            
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
        }
        
        return terms;
    }        
}
